package com.zonski.jbots.desktop.client.recolor;

import com.zonski.jbots.desktop.client.Recolorer;

/**
 * Created by IntelliJ IDEA.
 * User: Chris Glover
 * Date: Oct 23, 2003
 * Time: 1:44:50 PM
 * To change this template use Options | File Templates.
 */
public class GreyRecolorer implements Recolorer
{
    public static final GreyRecolorer INSTANCE = new GreyRecolorer();

    public int recolor(int color)
    {
        int avg = ((color & 0xFF) + ((color & 0xFF00) >> 8) + ((color & 0xFF0000) >> 16))/3;
        return (avg + (avg << 8) + (avg << 16)) | (color & 0xFF000000);
    }
}
